package cn.jhc.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet
public class CheckServlet extends HttpServlet{
  private static final long serialVersionUID = 1L;
	

	protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException {
		String username = request.getParameter("username");
		response.setContentType("application/json; charset=utf8");
		PrintWriter out = response.getWriter();
		if(username.equals("tom")) {
			out.println("{\"ok\":1}");
		} else {
			out.println("{\"ok\":0}");
		}
	}

}
